#ifndef DESKTOPITEM_H
#define DESKTOPITEM_H

#include <QGraphicsRectItem>
#include "consumerobj.h"

class DesktopItem : public QGraphicsRectItem,public ConsumerObj
{

public:
    explicit DesktopItem(int maxWidth,int maxHeight);
    DesktopItem();
    void initDesktop();


    void setPossiblePos(QList<int *> &poses);

    void clearPossiblePos();


    ~DesktopItem();

    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);

    double getD();

    double getR();

    double getSx();

    double getSy();

public slots:
    void sideChange(int value,int sideBelow);

    void setGameStart(bool v);


private:
    int maxWidth;
    int maxHeight;

    //棋牌一格长度d=2r
    double d;
    //棋子半径
    double r;

    //棋盘开始坐标
    double sx;
    double sy;

    //可移动点位
    QList<int *> poses;

    //当前走棋方
    int curSide=1;
    int sideBelow=1;

    int gameStart=false;

    // QGraphicsItem interface
protected:
    void mousePressEvent(QGraphicsSceneMouseEvent *event);
};

#endif // DESKTOPITEM_H
